package model.database;

import java.util.HashMap;


public class User {
	private Database database;
	private HashMap<String,String> fields;
	
	public User(Database database, int userId) {
		this.database = database;
		this.fields = database.getFieldsFrom("users", userId);
	}

	public void queueEmail(String message, String subject) {
		database.queueEmail(message,getEmail(), subject);
	}

	public String getEmail() {
		return this.fields.get("email");
	}

	public String getFullName() {
		return this.fields.get("firstname") + " " + this.fields.get("lastname");
	}

	public int getId() {
		return Integer.parseInt(fields.get("id"));
	}
}
